//V2.2.3 2021-10-7

//状态刷新函数，可以显示状态
function update() {
    var _classes = $('select option:selected').val();
    //console.log(_classes);
    $("#statusLabel").html("正在刷新...");
    $("#statusLabel").css("color", "");
    $.get("php/makeTable.php", {name:_classes},function (data) {
        $("#statusLabel").html(getTime() + " 刷新成功");

        $("#statusLabel").css("color", "");
        $("#list").html(data);
        //遍历detail
        $("#list tr td.detail").each(function () {
            $(this).html(changeUrl($(this).text()));
        });
    }).fail(function () {
        $("#statusLabel").html("刷新失败");
        $("#statusLabel").css("color", "red");
    });
    document.getElementsByClassName("detail").style = "display:none";
}
$(document).ready(function () {
    if(!window.clas ){
        window.clas = 'dddd';
    }

    update();
    document.getElementsByClassName("detail").style = "display:none";

    switchBox(0);
});

// $("#_select").change(update($("#_select").value));


function switchBox($id) { //切换DDL与通知
    switchID = $id; //switchID用于全局 0为DDL 1为通知

    //使所有选项标签变灰,box消失
    for (i = 0; i < 3; i++) {
        $("#selectorS" + i).removeClass("selectorActive");
        $("#selectorS" + i).addClass("selectorInactive");
        $("#box" + i).css("display","none");
    }
    
    //选项变蓝,box显示
    $("#selectorS" + switchID).removeClass("selectorInactive");
    $("#selectorS" + switchID).addClass("selectorActive");
    $("#box" + switchID).css("display","block");


}